package main

import (
	"fmt"
	"runtime"
	"time"
)

func main() {
	fmt.Println("?")
	var a [10]int
	for i := 0; i < 10; i++ {
		go func(i int) {
			for {
				a[i]++
				runtime.Gosched()
				//交出控制权
			}
		}(i)
	}
	time.Sleep(time.Millisecond)
	//Sleep，让子协程多执行一会儿
	//main退出后子协程都会死掉
	fmt.Println(a)
}
